/**
 * Check that weather the activex control is exists by clsid.
 *
 * @name: checkActiveXObjectIE
 * @author: luoluo
 * @date: 2009-04-16
 * @version: 1.0
 * 
 * @param{clsid}: Class ID string of activex control to be checked.
 * @param{timeout}: Checking time out time.
 * @param{proc}: 
 * 
 * Function for call back after check timeout, this function 
 * should recieve two args, clsid and the check result in boolean value.
 *
 * @sample:
 * 
 * checkActiveXObjectIE("B345F37E-6763-433b-BC53-9B526A9B7B8B", 
 *               1000, 
 *               function(clsid, loaded){alert(clsid + " " + loaded);}
 * );
 */
function checkActiveXObjectIE(clsid, timeout, proc) {
	var id = "ax" + Math.floor(Math.random() * 100000000);

	var html = "<object id=\"" + id + "\" classid=\"clsid:" + clsid;
	html += "\" style=\"display: none;\"><div style=\"display: none;\">";
	html += "</div><\/object>";

	if (document.body) {
		document.body.innerHTML += html;	
	} else {
		document.write(html);
		document.close();
	}

	setTimeout(function() {
		if (document.getElementById(id)) {
			proc(clsid, true);
		} else {
			proc(clsid, false);
		}
	}, timeout);
}